<?php
/*
 * GOLDENSHIELD MAIN CONFIGURATION FILE
 * Main configuration file for the game, where different values are set up
 * 
 * @author: Kasper B. Jensen
 * @version: 1.0
 */

/* FOLDERS */
define('JS_OBJ_FOLDER','jsobjects/'); //Javascritp folder
define('PHP_OBJ_FOLDER' , 'phpobjects/'); //PHP object folder
define('PLUGIN_FOLDER', 'plugin/'); //Folder for GoldenShield plugins

/* Extensions */
define('CLASS_EXT', 'class'); //Defines the extension for class files
define('PLUGIN_EXT', 'plugin'); //Defines the extension for plugin file

/* FILES */
define('MAIN_GAME_FILE', 'game.php'); //Defines the main game file containing the HTML to be used
define('XMAP_CONF_FILE', 'configFiles/xmapConfig.xml'); //Defines the XMAP configuration 
define('JQUERY', 'jq.js'); // Link to jQuery library

//Java script files
$javaObjects = array(); //An array containing the different javascript files

//Please be aware that the files will be loaded in the given order
$javaObjects['sound'] = 'sound.js';
$javaObjects['movementObject'] = 'movementObject.js';
$javaObjects['player'] = 'player.js';
$javaObjects['collision'] = 'collision.js';
$javaObjects['game'] = 'game.js';
$javaObjects['gui'] = 'gui.js';
$javaObjects['server'] = 'server.js';
$javaObjects['character'] = 'character.js';
$javaObjects['site'] = 'site.js';
$javaObjects['pluginHandler'] = 'pluginHandler.js';

//CSS Stylesheet files(loaded in the given order)
$cssFiles = array("style.css");

/* GAME CLIENT OPTIONS */
$gameJSOpt = array();
$gameJSOpt['startMap'] = "1_1";
$gameJSOpt['updateInterval'] = "30";
$gameJSOpt['dimensions']['width'] = "800";
$gameJSOpt['dimensions']['hight'] = "600";
$gameJSOpt['pluginFolder'] = PLUGIN_FOLDER;

/* GoldenShield Site Config Array */
$goldenConfig = array();
$goldenConfig['javaObjects'] = $javaObjects;
$goldenConfig['mainGameFile'] = MAIN_GAME_FILE;
$goldenConfig['jquery'] = JQUERY;
$goldenConfig['jsFolder'] = JS_OBJ_FOLDER;
$goldenConfig['cssFiles'] = $cssFiles;
$goldenConfig['title'] = "Version 1.5 Alpha | GoldenShield";
$goldenConfig['icon'] = "img/gui/16x16shield.ico";

 //Method for loading classes
function __autoload($class) {
    $class = strtolower($class);
    $classPath = PHP_OBJ_FOLDER. $class. '.'. CLASS_EXT. ".php";
    if(file_exists($classPath)) {
        require_once $classPath;
    } else {
        $classPath = PLUGIN_FOLDER. "$class/$class". PLUGIN_EXT. ".php";
        if(file_exists($classPath)) {
            require_once $classPath;
        }
    }
}
?>
